﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Project.MVC.Model;
using Project.MVC.Service;
using Project.MVC.Web.Models.Grid;
using Project.MVC.Web.Helper.jqGrid;
namespace Project.MVC.Web.Areas.QuanLy.Controllers
{
    public class TaiKhoanController : Controller
    {
        #region Services
        private readonly IUserServices services;

        public TaiKhoanController()
            : this(new UserServices()
            )
        {
        }

        public TaiKhoanController(IUserServices iservices

            )
        {
            services = iservices;

        }
        #endregion
        public ActionResult Index()
        {
            return View("Index");
        }

        #region Ajax and Json methods
        public JsonResult GetList(GridSettings grid, int? idChuDauTu, string trangThai)
        {

            IQueryable<UserInfo> list = null;
            list = services.GetList2Grid();
                        //THIẾT LẬP JQUERY GRID
            list = JqGrid.SetupGrid<UserInfo>(grid, list);

            return Json(list.ToJqGridData(grid.PageIndex, grid.PageSize, null, null, null), JsonRequestBehavior.AllowGet);
        }
        #endregion

    }
}
